<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta id="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
		<meta name="apple-themes-web-app-capable" content="yes">
		<meta content="yes" name="apple-mobile-web-app-capable">
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<meta content="telephone=no" name="format-detection">
		<meta content="email=no" name="format-detection">
		<meta name="format-detection" content="telephone=no">
		<title>发布评论</title>	
		<link rel="stylesheet" href="${s.base}/mobile/css/main.css" type="text/css" media="all">
	</head>

	<body>   
		<header id="header">
			<div class="header_con">
				<a href="javascript:history.go(-1);"><span></span></a> 
                <div class="top_tit">发布评论</div>         
			</div>
		</header>
		<style type="text/css">
			.font1{color:#F00;}
	
			
			.add-img{
				width: 100%;
				padding-left: 2%;
				height: 10.5em;
				overflow: hidden;
			}
			.img-con{
				width: 100%;
			}
			.add-img img{
				height: 5em;
				width: 5em;
				margin-right: 0.5em;
				margin-bottom: 0.5em;
				float: left;
			}
			.add-img span{
				height:4.8em;
				width:4.8em;
				line-height: 3.9em;
				display: block;
				float: left;
				color:#979797;
				text-align: center;	
				border: 1px solid #B5B5B5;
			}
			.add-img span input{
				opacity:0;
				position: absolute;
				height: 4.8em;
				width: 4.3em;
			}
			.add-img span:after{	
				content: "+";	
				text-align: center;
				font-size: 5em;
				z-index: 10;
			}
        </style>
        
		<div id="content_div" >
            <div class="wq_list">
              <ul>
              <li style="border:0px;">
               <i style="background: url(${item.imageOne}) no-repeat;background-size: 0.56rem 0.56rem;"></i>
               <p style="padding:0px; font-size: 0.28rem;color: #333;line-height: 0.38rem; margin-bottom:0.1rem;">${item.title}</p>
               <p><span>总   需：</span>  <em>${totalNum}</em>人次</p>
              </li>
              </ul>
            </div>
       
             <div class="pay_02" style="border:none;">
              <textarea id="content" placeholder="请输入分享内容" style="width: 98%; margin-left:1%; padding:5px 0px; height: 1.4rem;line-height: 0.5rem;margin-bottom:2px;border: 1px solid #ededed; border-radius:5px;" ></textarea>
             </div>
             <div class="pay_02" style="border:none;">
             <input type="file" id="myFile" name="myfiles" style="display:none;" onchange="ajaxFileUploadShow('myFile','iamgeOne','upload-image-one')" />
              <div class="add-img">
                  <div id="upload-image-one"></div>
                <span onClick="$('#myFile').click();"></span>
				  <input type="hidden" id="iamgeOne">
            </div>
             </div>
            <div class="yy_jl_box"  style="display:none;">
             <div class="yy_jl_no">
              <i></i>
              <p>您还没有购买哦！</p>
              <a>立即填写</a>
             </div>
             </div>
              <div class="pay_04 margin_top_1 lingqu"><a href="javascript:void(0)" id="publish" class="ui-btn">立即发布</a></div>
      	</div>	
           
        <script src="${s.base}/mobile/js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
		<script type="text/javascript" src="${s.base}/js/base/ajaxfileupload.js"></script>
		<script type="text/javascript" src="${s.base}/js/layer/layer.js"></script>
		<script type="text/javascript" src="${s.base}/js/base/commont.js"></script>
		<script type="text/javascript">
            function ajaxFileUploadShow(fileId,resultId,showId){
                //开始上传文件时显示一个图片,文件上传完成将图片隐藏
                //$("#loading").ajaxStart(function(){$(this).show();}).ajaxComplete(function(){$(this).hide();});
                //执行上传文件操作的函数
                $.ajaxFileUpload({
                    //处理文件上传操作的服务器端地址(可以传参数,已亲测可用)
                    url:'/file/fileUpload?uname=123',
                    secureuri:false,                           //是否启用安全提交,默认为false
                    fileElementId:fileId,               //文件选择框的id属性
                    dataType:'text',                           //服务器返回的格式,可以是json或xml等
                    success:function(data, status){            //服务器响应成功时的处理函数
                        data = data.replace(/<pre.*?>/g, '');  //ajaxFileUpload会对服务器响应回来的text内容加上<pre style="....">text</pre>前后缀
                        data = data.replace(/<PRE.*?>/g, '');
                        data = data.replace("<PRE>", '');
                        data = data.replace("</PRE>", '');
                        data = data.replace("<pre>", '');
                        data = data.replace("</pre>", '');     //本例中设定上传文件完毕后,服务端会返回给前台[0`filepath]
                        if(data.substring(0, 1) == 0){         //0表示上传成功(后跟上传后的文件路径),1表示失败(后跟失败描述)
                            $("#"+showId).html('<img  src="'+data.substring(2)+'" />');
                            $("#"+resultId).val(data.substring(2));
                        }else{
                            layer.alert('图片上传失败，请重试！！');
                        }
                    },
                    error:function(data, status, e){ //服务器响应失败时的处理函数
                        layer.alert('图片上传失败，请重试！！');
                    }
                });
            }
			$("#publish").on("click",function () {
				var memberId='${memberId}';
				var activityId ='${activityId}';
				var content=$("#content").val();
				if (content == null || content == ""){
					layer.alert("请输入分享内容");
					return false;
				}
				var image = $("#iamgeOne").val();
				$.post("/shareOrder/updateOrAddEntity",{
					memberId : memberId,
					activityId : activityId,
					content : content,
					image : image
				},function(result){
					if(1==result.returnInfo.state){
						showLayerAlertNoRefre("操作成功！");
					}else{
						showLayerAlertNoRefre(result.returnInfo.errorMsg);
					}
				},"json");
			});
		</script>
	</body>

</html>